************ Chapter 12. MODALITIES OF GEOGRAPHY

use data/Demo_book_country_3.dta, clear
************ democracy variables

* polyarchy, 100-point scale
gen v2x_polyarchy_100 = (v2x_polyarchy / .924) * 100

* polyarchy, missing obs imputed
impute v2x_polyarchy lexical_index inc_chall_combined , gen(v2x_polyarchy_imp)
* 100-point scale
replace v2x_polyarchy_imp = v2x_polyarchy_imp * 100
gen v2x_polyarchy_imp_100 = (v2x_polyarchy_imp / 92.4) * 100
replace v2x_polyarchy_imp_100 = . if sovereign_Cojocaru ==.

****** Table_12_1: Geographic Factors: Intercorrelations
pwcorr lp_lat_abst tropical avg_temp frstdays prec_gpcc irri_impact5 soil suita calories_mean calories_sd suit50_mfish mountains rugged Island predallports53_100km



****** Table_12_2: Geographic Factors: Specification tests 
*1) equator distance (latitude)
qui reg v2x_polyarchy_imp_100 lp_lat_abst i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(lp_lat_abst) replace
qui drop sample

*2) tropical
qui reg v2x_polyarchy_imp_100 tropical i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(tropical) append
qui drop sample

*3) temperature
qui reg v2x_polyarchy_imp_100 avg_temp i.year,vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(avg_temp) append
qui drop sample

*4) frost days
qui reg v2x_polyarchy_imp_100 frstdays i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(frstdays) append
qui drop sample

*5) precipitation, as quadratic (following Haber)
qui reg v2x_polyarchy_imp_100 c.prec_gpcc##c.prec_gpcc i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(c.prec_gpcc##c.prec_gpcc) append
qui drop sample

*6) irrigation potential (Bentzen et al)
*Share of land suitable for agriculture where irrigation can more than double agricultural production (land in Impact Class 5 as a share of land in Impact Classes 1-5).
*alternate measures: irri_impact4_5 irri_impact3_5 irri_impact2_5 irri_actcult irri1900 irri2000
qui reg v2x_polyarchy_imp_100 irri_impact5 i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(irri_impact5) append
qui drop sample

*7) fertile soil
qui reg v2x_polyarchy_imp_100 soil i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(soil) append
qui drop sample

*8) agricultural suitability
qui reg v2x_polyarchy_imp_100 suita i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(suita) append
qui drop sample

*9) caloric yield
qui reg v2x_polyarchy_imp_100 calories_mean i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(calories_mean) append
qui drop sample

*10) caloric yield variability
qui reg v2x_polyarchy_imp_100 calories_sd i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(calories_sd) append
qui drop sample

*11) fish
qui reg v2x_polyarchy_imp_100 suit50_mfish i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(calories_sd) append
qui drop sample

*12) mountains
qui reg v2x_polyarchy_imp_100 mountains i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(mountains) append
qui drop sample

*13) ruggedness
qui reg v2x_polyarchy_imp_100 rugged i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(rugged) append
qui drop sample

*14) island
qui reg v2x_polyarchy_imp_100 Island i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(Island) append
qui drop sample

*15) natural harbor distance
qui reg v2x_polyarchy_imp_100 predallports53_100km i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(predallports53_100km) append
qui drop sample

*16) all vars
qui reg v2x_polyarchy_imp_100 lp_lat_abst tropical avg_temp frstdays c.prec_gpcc##cc.prec_gpcc irri_impact5 soil suita calories_mean calories_sd suit50_mfish mountains rugged Island predallports53_100km i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(lp_lat_abst tropical avg_temp frstdays c.prec_gpcc##cc.prec_gpcc irri_impact5 soil suita calories_mean calories_sd suit50_mfish mountains rugged Island predallports53_100km) append
qui drop sample

*17) all vars sig (p<.05) in expected direction in previous test
qui reg v2x_polyarchy_imp_100 lp_lat_abst tropical avg_temp c.prec_gpcc##cc.prec_gpcc calories_mean predallports53_100km i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(lp_lat_abst tropical avg_temp c.prec_gpcc##cc.prec_gpcc calories_mean predallports53_100km) append
qui drop sample

*18) all vars sig (p<.05) in expected direction in previous test
qui reg v2x_polyarchy_imp_100 lp_lat_abst c.prec_gpcc##cc.prec_gpcc predallports53_100km i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(lp_lat_abst c.prec_gpcc##cc.prec_gpcc predallports53_100km) append
qui drop sample

*19) all vars sig (p<.05) in expected direction in previous test + regional dummies
qui reg v2x_polyarchy_imp_100 lp_lat_abst c.prec_gpcc##cc.prec_gpcc predallports53_100km i.e_regionpol4 i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(lp_lat_abst c.prec_gpcc##cc.prec_gpcc predallports53_100km) append
qui drop sample

*20) all vars sig (p<.05) in expected direction in previous test 
qui reg v2x_polyarchy_imp_100 lp_lat_abst predallports53_100km i.year, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_2.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(lp_lat_abst predallports53_100km) append
qui drop sample


****** Table_12_3: Geographic Factors, Predictive Power, 1960-
*1) year dummies
qui reg v2x_polyarchy_imp_100 i.year if predallports53_100km !=. & year > 1959, beta
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_3.doc, nocon se bdec(3) keep(predallports53_100km) replace
qui drop sample

*2) latitude
qui reg v2x_polyarchy_imp_100 lp_lat_abst i.year if predallports53_100km !=. & year > 1959, beta
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_3.doc, nocon se bdec(3) stats(beta) keep(lp_lat_abst ) append
qui drop sample

*3) natural harbor distance
qui reg v2x_polyarchy_imp_100 predallports53_100km i.year if predallports53_100km !=. & year > 1959, beta
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_3.doc, nocon se bdec(3) stats(beta) keep(predallports53_100km) append
qui drop sample

*4) both
qui reg v2x_polyarchy_imp_100 lp_lat_abst predallports53_100km i.year if predallports53_100km !=. & year > 1959, beta
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_3.doc, nocon se bdec(3) stats(beta) keep(lp_lat_abst predallports53_100km) append
qui drop sample

*5) both + European ancestry
qui reg v2x_polyarchy_imp_100 lp_lat_abst predallports53_100km eur_pct_est_smooth i.year if predallports53_100km !=. & year > 1959, beta
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_12_3.doc, nocon se bdec(3) stats(beta) keep(lp_lat_abst predallports53_100km) append
qui drop sample
